//package com.example.demo.controller;
//
//import com.example.demo.dao.testDao;
//import com.example.demo.entity.School;
//import com.example.demo.entity.User;;
//import com.example.demo.services.SchoolService;
//import com.example.demo.services.UserService;
//import com.example.demo.services.impl.UserServiceImpl;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiOperation;
//import org.elasticsearch.index.query.BoolQueryBuilder;
//import org.elasticsearch.index.query.QueryBuilder;
//import org.elasticsearch.index.query.QueryBuilders;
//import org.elasticsearch.index.query.QueryStringQueryBuilder;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.data.domain.Pageable;
//import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
//import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
//import org.springframework.data.elasticsearch.core.query.SearchQuery;
//import org.springframework.data.web.PageableDefault;
//import org.springframework.web.bind.annotation.*;
//
//
//import static org.elasticsearch.index.query.QueryBuilders.queryStringQuery;
//
//@RestController
//@RequestMapping("/")
//public class SampleController {
//    @Autowired
//    private UserService userService;
//
//    @Autowired
//    private SchoolService schoolService;
//
//    @Autowired
//    private testDao testdao;
//
//    @Autowired
//    private ElasticsearchTemplate elasticsearchTemplate;
//
//    @ApiOperation(value = "测试")
//    @GetMapping("/home")
//    String home() {
//        return "Hello World!";
//    }
//
//    @RequestMapping(value = "/getUser", method = RequestMethod.GET)
//    public User helloUser() {
//        User user = userService.getUserById(1);
//        System.out.println(user);
//        return user;
//    }
//
//    @ApiOperation(value = "采取mybatis方式查询")
//    @ApiImplicitParam(name = "id", value = "用户id", paramType = "path", required = true)
//    @GetMapping("/getSchool/maybatis/{id}")
//    public School helloSchool1(@PathVariable("id") int id) {
//        School school = schoolService.getSchoolById(id);
//        System.out.println(school);
//        return school;
//    }
//
//    @ApiOperation(value = "采取mybatis-plus方式查询")
//    @ApiImplicitParam(name = "id", value = "用户id", paramType = "path", required = true)
//    @GetMapping("/getSchool/maybatis-plus/{id}")
//    public School helloSchool2(@PathVariable("id") int id) {
//        School school = schoolService.selectById(id);
//        System.out.println(school);
//        return school;
//    }
//
//    @ApiOperation(value = "插入数据")
//    @ApiImplicitParam(name = "school", value = "学校信息", paramType = "body", required = true)
//    @PostMapping("/insert/school")
//    public Boolean insertSchool(@RequestBody School school) {
//        Boolean tag = schoolService.insert(school);
//        System.out.println(tag);
//        return tag;
//    }
//}